import { request } from '@/utils/request.util';
import type { Res, ResNull } from '@/types/common';
import type { Root, DeptListRoot } from '@/types/root';
import type {
  ClinicResponse,
  ClinicListForm,
  ClinicInfo,
} from '@/types/clinicInfo/index';

/**
 *
 * 获取诊所信息
 */
export const getClinicInfo = () =>
  request.get<Res<ClinicInfo>>('/clinic/info/getClinicInfo');

/**
 * 更新诊所信息
 * @param data 诊所信息
 */
export const updateClinicInfo = (data: ClinicInfo) =>
  request.post<ResNull>('/clinic/info/update', data);

/**
 * 获取诊所列表
 * @param params 查询参数
 */
export const getClinicList = (params?: any) =>
  request.get<Res<any>>('/clinic/dept/getRoomList',{params});

/**
 * 添加诊室
 * @param params 查询参数
 */
export const addClinicRoom = (params: ClinicListForm) =>
  request.post<ResNull>('/clinic/dept/addRoom', params);

/**
 * 查询诊所员工下拉框数据
  * @param params 查询参数
  */
export const getSelectList = () =>
  request.get<Res<any>>('/clinic/emp/getSelectList');
/**
 * 编辑诊室
 * @param params 查询参数
 */
export const editClinicRoom = (params: ClinicListForm) =>
  request.post<ResNull>('/clinic/dept/updateRoom', params);

/**
 * 删除诊室
 * @param roomId 诊室ID
 */
export const deleteClinicRoom = (params: any) =>
  request.post<ResNull>(`/clinic/dept/deleteRoom`, params);

/**
 * 启用诊室
 */
export const enableClinicRoom = (params: any) =>
  request.post<ResNull>('/clinic/dept/enableRoom', params);

/**
 * 停用诊室
 */
export const disableRoom = (params: any) =>
  request.post<ResNull>('/clinic/dept/disableRoom', params);

/**
 * 获取诊所科室列表
 * @param params 查询参数
 */
export const getClinicDeptList = (params?: any) =>
  request.get<Res<any>>('/clinic/dept/getDeptList',{params});


/**
 * 添加科室
 * @param params 查询参数
 */
export const addClinicDept = (params: any) =>
  request.post<ResNull>('/clinic/dept/addDept', params);
/**
 * 编辑科室
 * @param params 查询参数
 */
export const editClinicDept = (params: any) =>
  request.post<ResNull>('/clinic/dept/updateDept', params);
/**
 * 删除科室
 * @param deptId 科室ID
 */
export const deleteClinicDept = (params: any) =>
  request.post<ResNull>('/clinic/dept/deleteDept', params);

/**
 * 启用科室
 */
export const enableDept = (params: any) =>
  request.post<ResNull>('/clinic/dept/enableDept', params);

/**
 * 停用科室
 */
export const disableDept = (params: any) =>
  request.post<ResNull>('/clinic/dept/disableDept', params);

/**
 * 获取菜单列表
 * @param params 查询参数
 */
export const getClinicEmpList = () =>
  request.get<Res<any>>('/clinic/auth/getMenuList');

/**
 * 获取角色列表
 * @param params 查询参数
 */
export const getRoleList = (params?: any) =>
  request.get<Res<any>>('/clinic/auth/getRoleList', {params});

/**
 * 添加角色
 * @param params 查询参数
 */
export const addRole = (params: any) =>
  request.post<ResNull>('/clinic/auth/addRole', params);
/**
 * 编辑角色
 * @param params 查询参数
 */
export const editRole = (params: any) =>
  request.post<ResNull>('/clinic/auth/updateRole', params);
/**
 * 启用
 * @param params 查询参数
 */
export const enableRole = (params: any) =>
  request.post<ResNull>('/clinic/auth/enableRole', params);
/**
 * 停用
 * @param params 查询参数
 */
export const disableRole = (params: any) =>
  request.post<ResNull>('/clinic/auth/disableRole', params);

/**
 * 查询角色关联的菜单ID集合
 * @param params 查询参数
 */
export const getMenuIdListByRole = (roleId: any) =>
  request.get<Res<any>>('/clinic/auth/getMenuIdListByRole',{params: {
    roleId
  }});

/**
 * 删除角色
 * @param roleId 角色ID
 */
export const deleteRole = (params: any) =>
  request.post<ResNull>('/clinic/auth/deleteRole', params);
/**
 * 获取员工列表
 * @param params 查询参数
 */
export const getEmployeeList = (params?: any) =>
  request.get<Res<any>>('/clinic/emp/getEmpList', {params});
/**
 * 添加员工
 * @param params 添加员工
 */
export const addEmployee = (params: any) =>
  request.post<any>('/clinic/emp/add', params);
/**
 * 编辑员工
 * @param params 编辑员工
 */
export const editEmployee = (params: any) =>
  request.post<any>('/clinic/emp/update', params);
/**
 * 删除员工
 * @param empId 员工ID
 *
 */
export const deleteEmployee = (params: any) =>
  request.post<ResNull>('/clinic/emp/delete', params);

/**
 * 启用员工
 * @param empId 员工ID
 *
 */
export const empenable = (params: any) =>
  request.post<ResNull>('/clinic/emp/enable', params);
/**
 * 停用员工
 * @param empId 员工ID
 *
 */
export const empdisable = (params: any) =>
  request.post<ResNull>('/clinic/emp/disable', params);

/**
 * 重置员工密码
 * @param empId 员工ID
 */
export const resetEmployeePassword = (params: any) =>
  request.post<ResNull>('/clinic/emp/resetPassword', params);


// 获取员工详情
export const getEmpDetail = (params?: any) =>
  request.get<any>('/clinic/emp/getEmpDetail', {params});